package com.wanxi.test;

import java.util.Scanner;

public class CountString {
    public static void main(String[] args) {
        /**
         * 1.录入字符串
         * 2.拿到字符串里面的每个字符，判断字符在ascii码里面的区域
         */
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入字符串");
        String str = scanner.next();
        char[] chars = str.toCharArray();
        int countNum = 0;
        int countUpper = 0;
        int countLower = 0;
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] >= 48 && chars[i] <= 57) {
                countNum++;
            }
            if (chars[i] >= 65 && chars[i] <= 90) {
                countUpper++;
            }
            if (chars[i] >= 97 && chars[i] <= 122) {
                countLower++;
            }
        }
        System.out.println("数字出现的次数" + countNum);
        System.out.println("大写出现的次数" + countUpper);
        System.out.println("小写出现的次数" + countLower);
    }
}
